package routers

import (
	"fastgin/global"

	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

func Run() {
	gin.SetMode(global.Config.System.Mode)
	r := gin.Default()
	//静态路由 将目录uploads映射为静态路由
	r.Static("/uploads", "uploads")
	//静态路由 将文件test.log映射为静态路由
	// r.StaticFile("/test.log", "test.log")

	//路由分组
	g := r.Group("api")
	UserRouter(g)
	ImageRouter(g)
	CaptchaRouter(g)
	addr := global.Config.System.Addr()
	if global.Config.System.Mode == "release" {
		logrus.Infof("后端服务运行在 %s", addr)
	}
	r.Run(addr)
}
